/**
 * @description 商品出库
 */
import request from '@/utils/request'

/**
 * @description 条件分页查询出库单据
 * @param {Object} data 请求参数
 * @returns {Promise}
 */
export const getGoodsOutboundList = (data) => {
  return request({
    url: '/dealer/pzGoodsOutboundM/selectGoodsOutboundMByCondition',
    method: 'post',
    data,
  })
}

/**
 * @description 保存出库单
 * @param {Object} data 请求参数
 * @returns {Promise}
 */
export const saveGoodsOutbound = (data) => {
  return request({
    url: `/dealer/pzGoodsOutboundM/saveGoodsOutboundM`,
    method: 'post',
    data,
  })
}

/**
 * @description 根据id删除出库单
 * @param {String} id
 * @returns {Promise}
 */
export const deleteGoodsOutboundById = (id) => {
  return request({
    url: `/dealer/pzGoodsOutboundM/deleteGoodsOutboundMById?goodsOutboundMId=${id}`,
    method: 'post',
  })
}

/**
 * @description 获取商品库存(适用于商品出库)
 * @param {Object} data 请求参数
 * @returns {Promise}
 */
export const getDealerGoodsStoreListByConditionForOut = (data) => {
  return request({
    url: `
/dealer/pzDealerGoodsStore/getDealerGoodsStoreListByConditionForOut`,
    method: 'post',
    data,
  })
}

/**
 * @description 根据id查看出库单详情
 */
export const getGoodsOutboundById = (id) => {
  return request({
    url: `/dealer/pzGoodsOutboundM/viewGoodsOutboundMById?goodsOutboundMId=${id}`,
    method: 'post',
  })
}
